import app
import logging


class RechargeApi:
    # 获取充值验证码接口
    recharge_code_url = app.BASE_URL + "/common/public/verifycode/{}"
    # 充值接口
    recharge_url = app.BASE_URL + "/trust/trust/recharge"

    # 获取充值验证码接口
    @classmethod
    def get_recharge_code(cls, session, r):
        logging.info(f"param r={r}")
        url = cls.recharge_code_url.format(r)
        logging.info(f"url={url}")
        return session.get(url)

    # 充值
    @classmethod
    def recharge(cls, session, body):
        logging.info(f"param body={body}")
        return session.post(cls.recharge_url, data=body)
